<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>存储器数据通路实验 :: 计算机组成原理实验指导</title>
    <meta name="generator" content="Antora 3.2.0-alpha.8">
    <link rel="stylesheet" href="../../../_/css/site.css">
<!--    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script> -->
  </head>
  <body class="article">
<header class="header">
  <nav class="navbar">
    <div class="navbar-brand">
      <a class="navbar-item" href="../../..">计算机组成原理实验指导</a>
      <button class="navbar-burger" aria-controls="topbar-nav" aria-expanded="false" aria-label="Toggle main menu">
        <span></span>
        <span></span>
        <span></span>
      </button>
    </div>
    <div id="topbar-nav" class="navbar-menu">
      <div class="navbar-end">

        <div class="navbar-item">
          <span class="control">
            <a class="button is-primary" href="https://gitee.com/fpga-lab/digisimlab-open" target="_blank">Download</a>
          </span>
        </div>
      </div>
    </div>
  </nav>
</header>
<div class="body">
<div class="nav-container" data-component="digisimlab" data-version="1.2">
  <aside class="nav">
    <div class="panels">
<div class="nav-panel-menu is-active" data-panel="menu">
  <nav class="nav-menu">
    <button class="nav-menu-toggle" aria-label="Toggle expand/collapse all" style="display: none"></button>
    <h3 class="title"><a href="../index.html">计算机组成原理实验指导</a></h3>
<ul class="nav-list">
  <li class="nav-item" data-depth="0">
<ul class="nav-list">
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../index.html">前言</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="0">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">Digital仿真软件使用指南</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-brief-introduction.html">简介</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../introduce-digitalsim.html">下载、安装及启动</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-getting-started.html">新手入门</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-generate-circuit.html">电路生成</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-test-circuit.html">电路测试</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-sim-dff.html">时序电路仿真</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-other-useful.html">几个有用的组件</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-hierarchical-design.html">层次化设计</a>
  </li>
  <li class="nav-item" data-depth="1">
    <a class="nav-link" href="../ds-parametric-design.html">参数化设计</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="0">
<ul class="nav-list">
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">基本逻辑电路</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="bl-multiplexer.html">多路选择器实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="bl-decoder.html">译码器实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="bl-register.html">触发器和寄存器实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="bl-counter.html">计数器实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="dp-register_file.html">寄存器堆实验</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">运算器</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="op-add_sub_operation.html">加减运算电路实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="op-arithmetic_logic_unit.html">算术逻辑单元实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="op-compare.html">*比较运算电路实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="dp-single_cycle_datapath.html">运算器数据通路实验</a>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">存储器</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="mem-rom.html">ROM实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="mem-ram.html">RAM实验</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="mem-path.html">存储器应用实验</a>
  </li>
  <li class="nav-item is-current-page" data-depth="2">
    <a class="nav-link" href="mem-path-2.html">存储器数据通路实验</a>
  </li>
</ul>
  </li>
</ul>
  </li>
  <li class="nav-item" data-depth="0">
<ul class="nav-list">
  <li class="nav-item" data-depth="1">
    <button class="nav-item-toggle"></button>
    <span class="nav-text">控制器</span>
<ul class="nav-list">
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="cu-overview.html">概述（指令系统）</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="cu-hardwire_controller-1.html">硬布线控制实验（Ⅰ）</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="cu-hardwire_controller.html">硬布线控制实验（Ⅱ）</a>
  </li>
  <li class="nav-item" data-depth="2">
    <a class="nav-link" href="cu-hardwire_controller-3.html">硬布线控制实验（Ⅲ）</a>
  </li>
</ul>
  </li>
</ul>
  </li>
</ul>
  </nav>
</div>
<div class="nav-panel-explore" data-panel="explore">
  <div class="context">
    <span class="title">计算机组成原理实验指导</span>
    <span class="version">1.2</span>
  </div>
  <ul class="components">
    <li class="component is-current">
      <div class="title"><a href="../../index.html">计算机组成原理实验指导</a></div>
      <ul class="versions">
        <li class="version is-latest">
          <a href="../../index.html">1.31</a>
        </li>
        <li class="version is-current">
          <a href="../index.html">1.2</a>
        </li>
        <li class="version">
          <a href="../../1.1/index.html">1.1</a>
        </li>
        <li class="version">
          <a href="../../1.0/index.html">1.0</a>
        </li>
      </ul>
    </li>
  </ul>
</div>
    </div>
  </aside>
</div>
<main class="article">
<div class="toolbar" role="navigation">
<button class="nav-toggle"></button>
  <a href="../../index.html" class="home-link"></a>
<nav class="breadcrumbs" aria-label="breadcrumbs">
  <ul>
    <li><a href="../index.html">计算机组成原理实验指导</a></li>
    <li>存储器</li>
    <li><a href="mem-path-2.html">存储器数据通路实验</a></li>
  </ul>
</nav>
<div class="page-versions">
  <button class="version-menu-toggle" title="Show other versions of page">1.2</button>
  <div class="version-menu">
    <a class="version" href="../../lab/mem-path-2.html">1.31</a>
    <a class="version is-current" href="mem-path-2.html">1.2</a>
    <a class="version is-missing" href="../../1.1/index.html">1.1</a>
    <a class="version is-missing" href="../../1.0/index.html">1.0</a>
  </div>
</div>
</div>
  <div class="content">
<aside class="toc sidebar" data-title="页内目录" data-levels="2">
  <div class="toc-menu"></div>
</aside>
<article class="doc">
<h1 class="page">存储器数据通路实验</h1>
<div class="sect1">
<h2 id="_实验目的"><a class="anchor" href="#_实验目的"></a>实验目的</h2>
<div class="sectionbody">
<div class="olist arabic">
<ol class="arabic">
<li>
<p>掌握存储器的工作特性和使用方法。</p>
</li>
<li>
<p>理解实验电路的操作时序，掌握数据通路信息加工过程。</p>
</li>
<li>
<p>锻炼分析问题与解决问题的能力。</p>
</li>
</ol>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_实验原理"><a class="anchor" href="#_实验原理"></a>实验原理</h2>
<div class="sectionbody">
<div class="paragraph">
<p><a href="#fig-mem-path2-1">图 1</a>是本实验的存储器数据通路，该数据通路使用了前面实验中的ALU、三端口寄存器堆和RAM、ROM存储器。
和<a href="dp-single_cycle_datapath.html" class="xref page">运算器数据通路实验</a>相比，运算部分基本没有变化，新增加了存储器。
DI是RAM的数据输入端口，写入RAM的数据由寄存器堆的RD2读端口提供。
RAM的地址A来自ALU运算结果F。
RAM的读出数据DO通过多路器连接到寄存器堆的写端口WD，可以写入寄存器堆。
ROM作为七段译码器，连接数码管显示WD端口的数值。</p>
</div>
<div id="fig-mem-path2-1" class="imageblock">
<div class="content">
<img src="_images/mem-datapath2-1.png" alt="存储器数据通路">
</div>
<div class="title">图 1. 存储器数据通路</div>
</div>
<div class="paragraph">
<p>运算相关的信息加工过程在<a href="dp-single_cycle_datapath.html" class="xref page">运算器数据通路实验</a>中已经熟悉。
下面着重分析存储器相关的信息传递路径。</p>
</div>
<div class="sect2">
<h3 id="_寄存器数据写入ram的信息传递路径"><a class="anchor" href="#_寄存器数据写入ram的信息传递路径"></a>寄存器数据写入RAM的信息传递路径</h3>
<div class="paragraph">
<p>要将数据写入RAM，需准备要写入的数据并提供要写入单元的地址。
RAM的数据输入DI来自寄存器堆的读端口2，所以只能将某一寄存器的值写入RAM的存储单元；换句话说，需要写入RAM的数据必须先存放于某一寄存器中。
RAM的地址A来自ALU的输出F，因此只能通过ALU运算（通常用加法运算）产生RAM地址。从<a href="dp-single_cycle_datapath.html" class="xref page">运算器数据通路实验</a>已经知道，ALU的运算数据可以来自RD1、RD2或立即数Imm；但这里RD2已用于提供要写入RAM的数据，所以只能用RD1加上立即数来指定RAM的地址。
信息传递路径如<a href="#fig-mem-path2-2">图 2</a>绿色通路所示。</p>
</div>
<div id="fig-mem-path2-2" class="imageblock">
<div class="content">
<img src="_images/mem-path2-2.png" alt="mem path2 2">
</div>
<div class="title">图 2. 寄存器数据写入RAM的信息传递路径</div>
</div>
</div>
<div class="sect2">
<h3 id="_读出ram数据写入寄存器的信息传递路径"><a class="anchor" href="#_读出ram数据写入寄存器的信息传递路径"></a>读出RAM数据写入寄存器的信息传递路径</h3>
<div class="paragraph">
<p>RAM的地址仍然由ALU产生，RAM输出数据DO要传送到寄存器堆的写端口WD需要经过多路器的选择。
信息传递路径如<a href="#fig-mem-path2-3">图 3</a>绿色通路所示。</p>
</div>
<div id="fig-mem-path2-3" class="imageblock">
<div class="content">
<img src="_images/mem-path2-3.png" alt="mem path2 3">
</div>
<div class="title">图 3. 读出RAM数据写入寄存器的信息传递路径</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_实验任务"><a class="anchor" href="#_实验任务"></a>实验任务</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_设计任务"><a class="anchor" href="#_设计任务"></a>设计任务</h3>
<div class="paragraph">
<p>用Digital仿真软件按照<a href="#fig-mem-path2-1">图 1</a>绘制电路图。</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="提示"></i>
</td>
<td class="content">
<div class="olist loweralpha">
<ol class="loweralpha" type="a">
<li>
<p>可以在前面<a href="dp-single_cycle_datapath.html" class="xref page">运算器数据通路实验</a>电路图的基础上扩充。</p>
</li>
<li>
<p>ROM和数码管电路可以直接复制<a href="mem-rom.html" class="xref page">ROM实验</a>中完成的电路。</p>
</li>
</ol>
</div>
</td>
</tr>
</table>
</div>
</div>
<div class="sect2">
<h3 id="_验证任务"><a class="anchor" href="#_验证任务"></a>验证任务</h3>
<div class="paragraph">
<p>通过仿真验证数据通路，并保存仿真过程数据文件。</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>常数写入寄存器堆</p>
<div class="paragraph">
<p>将2个非零常数存入R2、R3寄存器。
信息传递路径与<a href="dp-single_cycle_datapath.html" class="xref page">运算器数据通路实验</a>基本相同，不同之处是寄存器堆写端口WD增加了一个多路选择器，写入数据来自ALU的运算结果时，WDsel应为0。</p>
</div>
</li>
<li>
<p>ALU运算结果存入寄存器</p>
<div class="ulist">
<ul>
<li>
<p>以寄存器R2、R3作为运算数，执行某种ALU运算，运算结果存入R1寄存器;</p>
</li>
<li>
<p>以寄存器R2和立即数（ImmediateData）作为运算数，运算结果存入R3;</p>
</li>
</ul>
</div>
</li>
<li>
<p>寄存器数据写入RAM</p>
<div class="paragraph">
<p>理解<a href="#fig-mem-path2-2">图 2</a>信息传递路径，完成以下验证。</p>
</div>
<div class="ulist">
<ul>
<li>
<p>以R2作为RAM的地址，将R1的内容写入该地址单元;</p>
</li>
<li>
<p>以立即数Imm作为RAM的地址，将R3的内容写入该地址单元。</p>
<div class="paragraph">
<p>注意立即数应与R2的值不相同，以免覆盖上面写入的单元。</p>
</div>
<div class="admonitionblock tip">
<table>
<tr>
<td class="icon">
<i class="fa icon-tip" title="提示"></i>
</td>
<td class="content">
<div class="paragraph">
<p>RAM地址A=RD1+Imm。
若要以R2作为RAM的地址，则RA1=2，同时使Imm=0。
若要以立即数Imm作为RAM的地址，则应使用R0的值（恒为0）作为RD1，即RA1=0。</p>
</div>
</td>
</tr>
</table>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>读出RAM数据并写入寄存器</p>
<div class="paragraph">
<p>理解<a href="#fig-mem-path2-3">图 3</a>信息传递路径，先后将上面写入RAM两个存储单元的内容读出，分别存入R3和R1寄存器。即：</p>
</div>
<div class="ulist">
<ul>
<li>
<p>以立即数Imm作为RAM的地址，读出该地址单元的内容并写入R1寄存器；</p>
</li>
<li>
<p>以R2作为RAM的地址，读出该地址单元的内容并写入R3寄存器。</p>
</li>
</ul>
</div>
</li>
</ol>
</div>
</div>
<div class="sect2">
<h3 id="_实验结果分析"><a class="anchor" href="#_实验结果分析"></a>实验结果分析</h3>
<div class="paragraph">
<p>对上述验证任务的实验数据进行分析，判断结果的正确性。
此外还应检查ROM输出和数码管显示是否正确，ROM的输出（Seg）为数码管的段值，数码管显示的数字应与WD相同。</p>
</div>
<div class="paragraph">
<p>若结果与预期不符，尝试独立分析故障现象并排除故障，锻炼分析问题与解决问题的能力。</p>
</div>
<div class="sidebarblock text-center">
<div class="content">
<div class="title">许可 | License</div>
<div class="paragraph">
<p><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA：署名-非商业性使用-相同方式共享 4.0 国际许可协议</a></p>
</div>
<div class="paragraph">
<p>作者：
肖铁军 &lt;<a href="mailto:xiaotiejun@foxmail.com.cn">xiaotiejun@foxmail.com.cn</a>&gt;</p>
</div>
</div>
</div>
</div>
</div>
</div>
</article>
  </div>
</main>
</div>
<footer class="footer">
  <p>This page was built using the Antora default UI.</p>
  <p>The source code for this UI is licensed under the terms of the MPL-2.0 license.</p>
</footer>
<script id="site-script" src="../../../_/js/site.js" data-ui-root-path="../../../_"></script>
<script async src="../../../_/js/vendor/highlight.js"></script>
  </body>
</html>
